QuickOPC User's Guide and Reference
Working with generic data
Extensions > Integrated Extensions > OPC UA Complex Data Extension > Generic data and data types > Working with generic data
In This Topic

Generic data is represented by instances of types derived from the GenericData Class. The GenericData Class is a base abstract class that is concretized by its subtypes to enumerations, sequences, structures etc., as described in Generic data kinds

Data type

Generic data can optionally have a data type associated with in, in its DataType Property. The data type provides metadata about what is contained in the generic data value itself. In addition, it provides a means to validate the generic data. Refer to Generic data validation for details on the validation.

The data type assigned to the DataType Property of any generic value must always be the same as the kind of the generic data itself. For example, only enumeration data type can be assigned to enumeration generic data. The GenericData Class and its derivatives check the kind of data type being assigned automatically, and it is not possible to assign a data type of an incorrect kind to the DataType Property (an attempt to do so throws an exception). For this reason, checking the match of data type kinds versus is not necessary during and is not part of generic data validation.

Displaying generic data

When you invoke the ToString Method on some generic data object, or view it in the debugger, you will get a short, on-line rendering of the generic data. It contains the name of its data type (if available), its kind (such as 'structured' or 'enumerable'), and possibly some details specific to the generic data kind (such as the value of primitive data and the .NET type associated with ir, or a length of a sequence). You may get, for example:

(ScalarValueDataType) structured

If you want to see the information about the internals of the data type, you can use the "V" (verbose) format specifier. For example, this code (C#):

Console.WriteLine("{0:V}", genericData); 

may produce following output (truncated):

(ScalarValueDataType) structured
  [BooleanValue] (Boolean) primitive; True {System.Boolean}
  [ByteStringValue] (ByteString) primitive; System.Byte[] {System.Byte[]}
  [ByteValue] (Byte) primitive; 153 {System.Byte}
  [DateTimeValue] (DateTime) primitive; 5/11/2013 4:32:00 PM {System.DateTime}
  [DoubleValue] (Double) primitive; -8.93178007363702E+27 {System.Double}
  [EnumerationValue] (Int32) primitive; 0 {System.Int32}
  [ExpandedNodeIdValue] (ExpandedNodeId) structured
    [NamespaceURI] (CharArray) primitive; "http://samples.org/UA/memorybuffer/Instance" {System.String}
    [NamespaceURISpecified] (Bit) primitive; True {System.Boolean}
    [NodeIdType] (NodeIdType) enumeration; 3 (String)
    [ServerIndexSpecified] (Bit) primitive; False {System.Boolean}
    [String] (StringNodeId) structured
      [Identifier] (CharArray) primitive; "????" {System.String}
      [NamespaceIndex] (UInt16) primitive; 0 {System.UInt16}
  [FloatValue] (Float) primitive; 78.37176 {System.Single}
  [GuidValue] (Guid) primitive; 8129cdaf-24d9-8140-64f2-3a6d7a957fd7 {System.Guid}
  [Int16Value] (Int16) primitive; 2793 {System.Int16}
  [Int32Value] (Int32) primitive; 1133391074 {System.Int32}
  [Int64Value] (Int64) primitive; -1039109760798965779 {System.Int64}
  [Integer] (Variant) structured
    [ArrayDimensionsSpecified] sequence[1]
      [0] (Bit) primitive; False {System.Boolean}
    [ArrayLengthSpecified] sequence[1]
      [0] (Bit) primitive; False {System.Boolean}
    [Int64] sequence[1]
      [0] (Int64) primitive; 0 {System.Int64}
    [VariantType] sequence[6]
      [0] (Bit) primitive; False {System.Boolean}
      [1] (Bit) primitive; False {System.Boolean}
      [2] (Bit) primitive; False {System.Boolean}
      [3] (Bit) primitive; True {System.Boolean}
      [4] (Bit) primitive; False {System.Boolean}
      [5] (Bit) primitive; False {System.Boolean}
  [LocalizedTextValue] (LocalizedText) structured
    [Locale] (CharArray) primitive; "ko" {System.String}
    [LocaleSpecified] (Bit) primitive; True {System.Boolean}
    [Reserved1] sequence[6]
      [0] (Bit) primitive; False {System.Boolean}
      [1] (Bit) primitive; False {System.Boolean}
      [2] (Bit) primitive; False {System.Boolean}
      [3] (Bit) primitive; False {System.Boolean}
      [4] (Bit) primitive; False {System.Boolean}
      [5] (Bit) primitive; False {System.Boolean}
    [Text] (CharArray) primitive; "? ?? ??+ ??? ??) ?: ???? ?! ?!" {System.String}
    [TextSpecified] (Bit) primitive; True {System.Boolean}
  [NodeIdValue] (NodeId) structured

If you want to see the internals of the generic data in debugger, you can, of course, inspect its properties, sub-properties and so on. That can be quite a tedious task. For a quick overview, you can view the generic data in the same format as with the "V" (verbose) format specifier. To do so, find the DebugView property of the generic data, and display its contents (possibly using the Text Visualizer in Visual Studio debugger). Note that the DebugView property is private, and therefore is not listed in the reference documentation for the component.  

See Also

Reference